<?php
/**
 * 
 * @author François Guégnaud
 * @version 1.0-1
 */
class HackInPain_View {
	
	protected $_file;
	
	public $content;
	
	/**
	 * Assign a value to a key. The key will be avaible in the view
	 * @param mixte $key
	 * @param mixte $value
	 */
	public function assign($key, $value) {
		$this->$key = $value;
	}
	
	/**
	 * Set view's file name by using controller's name
	 * @param string $name
	 */
	public function setFileByControllerName($name) {
		$name = preg_replace('/_/', '/', $name);
		$pos = strrpos($name, '/');
		$name = substr($name, 0, $pos);
		$this->_file = $name.'/View.phtml';
	}
	
	/**
	 * Set view's file name
	 * @param string $name
	 */
	public function setFile($name) {
		$this->_file = 'Application/'.$name.'/View.phtml';
	}

	/**
	 * Get view's file name
	 * @return string $_file
	 */
	public function getFile() {
		return $this->_file;
	}

}